<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
class PHPExcel_Writer_Excel5_BIFFwriter
{
    public $_data;
    public $_datasize;
    private $limit = 8224;
    private static $byteOrder;
    public function __construct()
    {
        $this->_data = "";
        $this->_datasize = 0;
    }
    public static function getByteOrder()
    {
        if(!isset(self::$byteOrder)) {
            $teststr = pack("d", 1.2345);
            $number  = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
            if($number == $teststr) {
                $byte_order = 0;
            } elseif($number == strrev($teststr)) {
                $byte_order = 1;
            } else {
                throw new PHPExcel_Writer_Exception("Required floating point format not supported on this platform.");
            }
            self::$byteOrder = $byte_order;
        }
        return self::$byteOrder;
    }
    protected function append($data)
    {
        if($this->limit < strlen($data) - 4) {
            $data = $this->addContinue($data);
        }
        $this->_data .= $data;
        $this->_datasize += strlen($data);
    }
    public function writeData($data)
    {
        if($this->limit < strlen($data) - 4) {
            $data = $this->addContinue($data);
        }
        $this->_datasize += strlen($data);
        return $data;
    }
    protected function storeBof($type)
    {
        $record = 2057;
        $length = 16;
        $unknown = pack("VV", 65745, 1030);
        $build = 3515;
        $year = 1996;
        $version = 1536;
        $header = pack("vv", $record, $length);
        $data = pack("vvvv", $version, $type, $build, $year);
        $this->append($header . $data . $unknown);
    }
    protected function storeEof()
    {
        $record = 10;
        $length = 0;
        $header = pack("vv", $record, $length);
        $this->append($header);
    }
    public function writeEof()
    {
        $record = 10;
        $length = 0;
        $header = pack("vv", $record, $length);
        return $this->writeData($header);
    }
    private function addContinue($data)
    {
        $limit = $this->limit;
        $record = 60;
        $tmp = substr($data, 0, 2) . pack("v", $limit) . substr($data, 4, $limit);
        $header = pack("vv", $record, $limit);
        $data_length = strlen($data);
        $i = $limit + 4;
        while ($i < $data_length - $limit) {
            $tmp .= $header;
            $tmp .= substr($data, $i, $limit);
            $i += $limit;
        }
        $header = pack("vv", $record, strlen($data) - $i);
        $tmp .= $header;
        $tmp .= substr($data, $i, strlen($data) - $i);
        return $tmp;
    }
}

?>